{include file="public/header" /}
<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div class="ibox float-e-margins">
        <div class="ibox-content">
            <div class="row">
                <div class="col-sm-12">
                    <div class="layui-form layui-form-item" >

                        <div class="layui-input-inline">
                            <input type="text"  name="create_start_time" onfocus="wk.lay_date(this);" class="layui-input layer-date search" placeholder="创建开始日期"/>
                        </div>

                        <div class="layui-input-inline">
                            <input type="text"  name="create_end_time" onfocus="wk.lay_date(this);"  class="layui-input layer-date search" placeholder="创建结束日期"/>
                        </div>

                        <div class="layui-col-md6 layui-input-inline">
                            <select name="yue_status" lay-search="">
                                <option  value="">不限状态</option>
                                <option  value="1">应征中</option>
                                <option  value="7">待付款</option>
                                <option  value="2">待完成</option>
                                <option  value="3">待收货</option>
                                <option  value="4">已取消</option>
                                <option  value="5">已收货</option>
                                <option  value="6">已失效</option>
                            </select>
                        </div>

                        <div class="layui-col-md6 layui-input-inline">
                            <input type="text" id="user_keyword" class="layui-input search" name="user_keyword" placeholder="用户ID/昵称"/>
                        </div>

                        <div class="layui-col-md6 layui-input-inline">
                            <input type="text" id="yue_title" class="layui-input search" name="yue_title" placeholder="约稿标题"/>
                        </div>

                        <div class="layui-input-inline"  style="margin-top: 8px">
                            <button class="layui-btn" lay-submit="" lay-filter="LAY-search">立即搜索</button>
                            <button  class="layui-btn layui-btn-normal" id="empty"  lay-submit="" lay-filter="LAY-search">重置</button>
                        </div>
                    </div>
                </div>
                <!--操作框开始-->

                <!--操作框结束-->
            </div>
            <div class="hr-line-dashed"></div>

            <div class="example-wrap">
                <div class="example">
                    <table class="layui-hide" id="test" lay-filter="testReload"></table>

                    <!--图片模板-->


                    <!--状态显示模板-->
                    <script type="text/html" id="yueStatus">
                        {{# if(d.yue_status == 1){ }}
                        应征中
                        {{# } }}
                        {{# if(d.yue_status == 2){ }}
                        待完成
                        {{# } }}
                        {{# if(d.yue_status == 3){ }}
                        待收货
                        {{# } }}
                        {{# if(d.yue_status == 4){ }}
                        已取消
                        {{# } }}
                        {{# if(d.yue_status == 5){ }}
                        已收货
                        {{# } }}
                        {{# if(d.yue_status == 6){ }}
                        已失效
                        {{# } }}
                        {{# if(d.yue_status == 7){ }}
                        待付款
                        {{# } }}
                    </script>

                    <script type="text/html" id="yueStat">
                        {{# if(d.yue_stat == 1){ }}
                        上架中
                        {{# } }}
                        {{# if(d.yue_stat == 2){ }}
                        已下架
                        {{# } }}
                    </script>

                    <!--操作模板-->
                    <script type="text/html" id="opeBar">
                        <a href="javascript:;" onclick="wk.layer_show('详情','{:url('yueDetail')}?yue_id={{d.yue_id}}')" class="btn btn-warning btn-xs m-r-xs" title="详情"><i class="fa fa-search">详情</i></a>
                        <a href="javascript:;" onclick="wk.layer_show('应征画师','{:url('yuePainter')}?yue_id={{d.yue_id}}')" class="btn btn-warning btn-xs m-r-xs" title="应征画师"><i class="fa fa-search">应征画师</i></a>
                        {{# if(d.yue_stat == 1) { }}
                        <a href="javascript:;" onclick="wk.confirm('{{d.yue_id}}','{:url('yueDown')}', '确定下架？')" class="btn btn-warning btn-xs m-r-xs" title="下架"><i class="fa fa-arrow-down">下架</i></a>
                        {{# } }}
                        {{# if(d.yue_stat == 2) { }}
                        <a href="javascript:;" onclick="wk.confirm('{{d.yue_id}}','{:url('yueOn')}', '确定上架？')" class="btn btn-info btn-xs m-r-xs" title="上架"><i class="fa fa-arrow-up">上架</i></a>
                        {{# } }}
                    </script>
                </div>
            </div>
        </div>
    </div>
</div>
{include file="public/footer" /}
<script>
    //layui渲染数据表格
    layui.use('table', function () {
        var table = layui.table
                , form = layui.form;
        table.render({
            elem: '#test'
            , url: '{:url("Yue/index")}'
            ,response: {
                statusCode: 220 //成功的状态码，默认：0
            }
            , page: true
            , size: 'lg' //sm小尺寸的表格 lg大尺寸
            , cellMinWidth: 150
            , limits: [5, 10, 15, 20, 25, 30]
            , limit: "{:config('pages')}"
            , loading: true
            , id: 'testReload'
            , cols: [[
//                {type: 'checkbox', fixed: 'left',}
//                {type:'numbers', width: 60, title: '序号'}
                  {field: 'user_id', width: 80, title: '用户ID', align: 'center'}
                , {field: 'user_username', width: 120, title: '用户昵称', align: 'center'}
                , {field: 'yue_title', width: '', title: '标题', align: 'center'}
                , {field: 'yue_status', width: 80, title: '状态', align: 'center', toolbar: '#yueStatus'}
                , {field: 'yue_stat', width: 80, title: '上/下架', align: 'center', toolbar: '#yueStat'}
                , {field: 'yue_start_time', width: 120, title: '开始日期', align: 'center'}
                , {field: 'yue_end_time', width: 120, title: '结束日期', align: 'center'}
                , {field: 'yue_day_num', width: 80, title: '周期/天', align: 'center'}
                , {field: 'yue_price', width: 120, title: '费用', align: 'center'}
                , {field: 'yue_time', width: 160, title: '创建时间', align: 'center'}
                , {fixed: 'right', width: 220, title: '操作', align: 'center', toolbar: '#opeBar'}
            ]]
            ,done: function (res, curr, count) {
                $('.img-circle').viewer({
                    url: 'data-original',
                });
            }
        });

        var getIds = function () {
            var ids = [];
            var checkStatus = table.checkStatus('testReload')
                    ,data = checkStatus.data;
            $.each(data,function(index,item){
                ids.push(item['yue_id'])
            });
            return ids;
        }
    });
</script>
</body>
</html>